package com.base.test.mysql2es.model;

import com.base.test.mysql2es.util.CollectionUtil;
import com.base.test.mysql2es.util.ObjectUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class Config {

    /**
     * 增量数据保存地, 默认写到临时文件(-Djava.io.tmpdir=)
     * window 是在 C:\Users\current_user\AppData\Local\Temp 下, GNU/Linux 是在 /tmp 下
     */
    private IncrementStorageType incrementType = IncrementStorageType.TEMP_FILE;

    /** 每次同步前都删除临时文件 */
    private boolean deleteTempEveryTime = false;

    private List<Relation> relation;

    public void check() {
        ObjectUtil.assertException(CollectionUtil.isEmpty(relation), "must set [db es] relation");
        for (Relation r : relation) {
            r.check();
        }
    }
}
